<template>
	<div class="subpage resaletab3end">
		<div class="resaletab3end-container">
			<ul class="purchase-order-list">
				<li>
					<p class="order-code">订单编号：{{item.outTradeNo}}</p>
					<div class="order-content">
						<div class="order-img">
							<img :src="item.smallPic" alt="">
						</div>
						<div class="order-text">
							<p class="pro-name">{{item.productName}}({{item.farmName}}）</p>
							<p class="pro-address"><span>养殖地：{{item.originProvince}}</span><span>牧场：{{item.farmName}}</span></p>
							<p class="pro-weight"><span>重量：{{item.productWeight}}{{item.productWeightUnit}}</span><span>单价：{{item.salesPrice}}{{item.salesPriceUnit}}</span></p>
							<p class="pro-price"><span class="pro-c"><i>{{item.totalPrice}}</i>{{item.totalPriceUnit}}</span></p>
							<p class="pro-dete"><span>剩余交货期：<i>{{item.deliveryMonth}}个月</i></span></p>
						</div>
					</div>
				</li>
			</ul>

			<ul class="calculation-box">
				<li>
					<div class="list-box">
						<span class="left">转售数量</span>
						<span class="right">{{item.quantity}}头</span>
					</div>
				</li>
				<li>
					<div class="list-box">
						<span class="left">总重量</span>
						<span class="right">{{item.productTotalWeight}}kg</span>
					</div>
				</li>
				<li>
					<div class="list-box">
						<span class="left">总金额</span>
						<span class="right price">{{item.orderMoney}}元</span>
					</div>
				</li>
				<li>
					<div class="list-box">
						<span class="left">转售时间</span>
						<span class="right">{{item.resaleTime}}</span>
					</div>
				</li>
			</ul>
			<div class="ht-box" @click="to">
				<span><img src="@/assets/img/contract_icon.png" alt="">
					友牧农场服务协议</span>
				<span>
					<van-icon name="arrow" color="#E5E5E5" size="17px" /></span>
			</div>
		</div>

		<div class="footer">
			<p class="total"><span class="totalMoney">转售金额：{{item.payMoney}}元</span></p>
			<van-button round class="u-btn-default bind-btn">已转售</van-button>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				item: {}
			}
		},
		created() {
			this.getResaletab3end()
		},
		methods: {
			to() {
				this.$router.push({
					name: 'supplyAgreement',
					query: {
						id: this.item.contractId
					}
				})
			},
			// 详情接口
			getResaletab3end() {
				this.$api.get('/api/resale/detail/' + this.$route.params.id)
					.then(({data}) => {
						console.log(data)
						this.item = data;
					})
			}
		},

	}
</script>

<style lang="scss" scoped>
	@import '../resalecomponent/resaleheadScss.scss';

	.ht-box {
		width: 100%;
		height: 53px;
		line-height: 53px;
		color: #333333;
		font-size: 15px;
		padding-left: 20px;
		padding-right: 17px;
		display: flex;
		justify-content: space-between;
		background-color: #fff;
		margin-top: 10px;

		img {
			width: 22px;
			margin-right: 12px;
			vertical-align: middle;
		}

		span {
			&:last-child {
				margin-top: 4px;
			}
		}
	}

	.resaletab3end-container {
		width: 100%;
		height: calc(100% - 63px);
		overflow-y: scroll;
		-webkit-overflow-scrolling: touch;
	}

	.footer {
		width: 100%;
		height: 63px;
		padding: 0 16px;
		line-height: 63px;
		position: fixed;
		left: 0;
		bottom: 0;
		background-color: #fff;
		box-shadow: 2px 2px 5px #c2c2c2;
		-webkit-box-shadow: 2px 2px 5px #c2c2c2;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.total {
			color: #F58523;
			font-size: 16px;
			font-weight: 500;
		}

		.bind-btn {
			width: 144px;
			height: 51px;
			background: #D0CFCF;
			border-radius: 26px;
			color: #fff;
			font-size: 16px;
			box-shadow: none;
		}
	}
</style>
